package com.soku.wangheng.xcoder.servlet;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.springframework.web.context.support.WebApplicationContextUtils;

import com.soku.wangheng.xcoder.config.ConfigManager;



public class InitServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6595707298448472566L;
	
	@Override
	public void init(ServletConfig config) throws ServletException {
		super.init(config);//important!
		String root = getServletContext().getRealPath("/");
		String configPath = root + getInitParameter("config_home");
		ConfigManager.I.init(configPath);
		ConfigManager.I.setApplicationContext(WebApplicationContextUtils.getWebApplicationContext(getServletContext()));
	}

}
